/**
 * 
 */
package org.xlab.baseframework.conf;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.xlab.baseframework.aspect.AspectForServices;
import org.xlab.baseframework.aspect.SecurityAcpectForWebService;
import org.xlab.baseframework.system.SystemEventPublisher;
import org.xlab.baseframework.system.SystemStartup;

/**
 * @author MaKuBEX
 * 
 */
@Configuration
public class AppConfiguration {
	@Bean(autowire = Autowire.BY_NAME, name = "bpf_aspectForServices")
	public AspectForServices aspectForServices() {
		return new AspectForServices();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemMessageSource")
	@Qualifier("bpf_systemMessageSource")
	public MessageSource bpfSystemMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(
				"org/xlab/baseframework/i18n/systemInformation",
				"org/xlab/baseframework/i18n/systemEventInformation");
		return messageSource;
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_aspectForWebServices")
	public SecurityAcpectForWebService securityAcpectForWebService() {
		return new SecurityAcpectForWebService();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemEventPublisher")
	public SystemEventPublisher systemEventPublisher() {
		return new SystemEventPublisher();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemStartup")
	public InitializingBean systemStartup() {
		return new SystemStartup();
	}

}
